import axios from 'axios';


const isProduction = process.env._NODE_PATH === 'devlopment' ? '/farmland' : '';
const instance = axios.create({
    baseURL: !isProduction,
    timeout: 1000,
});

instance.interceptors.request.use(function(config) {
    return config;
}, function(error) {
    return Promise.reject(error);
});

instance.interceptors.response.use(function(response) {
    return response.data;
}, function(error) {
    return Promise.reject(error);
});

export default {
    get(url, data) { 
        return instance.get(url, { params: data })
    },
    post(url, data) { 
        return instance.post(url, data)
    }
}